<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //变量名与属性名同名
      let obj = { name: 'abc', age: 18, height: 185 }
      // let { age, height } = obj
      // console.log(age, height)

      //变量名和属性名不同名
      //let obj = { name: 'abc', age: 18, height: 185 }
      //冒号右边是变量名
      //let {age,height:h}=obj

      //属性允许重复使用
      // let { age, height: h, age: myAge } = obj
      // console.log(age, h, myAge)

      //与rest配合使用
      let { age, ...myObj } = obj
      console.log(age, myObj.name, myObj.height)
    </script>
  </body>
</html>
